<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
    <link rel="stylesheet" href="" />
  </head>
  <body>
    <div>第1个div</div>
    <p>第3个p</p>
    <div>第2个div</div>
    <p>第2个p</p>
    <div>第3个div</div>
    <p>第1个p</p>

    <ul class="parent">
      <li>
        <span>1</span>
        <i>1</i>
      </li>
      <li>
        <span>2</span>
        <i>2</i>
      </li>
      <li>
        <span>3</span>
        <i>3</i>
      </li>
      <li>
        <span>4</span>
        <i>4</i>
      </li>
    </ul>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script>
      $(function () {
        $('div')
          .css('border', '2px solid red')
          .add('p')
          .css('background', 'yellow')
          .end() // 将集合状态回退一层
          .css('font-size', '28px')

          $('.parent')
          .find('i')
          .css('color', 'red')
          .end()
          .css('border', '1px solid blue')
      })
    </script>
  </body>
</html>
